package com.liusand.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liusand.xo.pojo.Blog;
import com.liusand.xo.vo.BlogVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author LiuSha
 */
@Mapper
public interface BlogMapper extends BaseMapper<Blog> {

//    @Select("select blog.blog_id, category.category_Name, title, author, blog.created\n" +
//            "from blog_w.blog\n" +
//            "left join blog_w.category\n" +
//            "on blog.category_id=category.category_id\n" +
//            "where blog.deleted is null\n"+
//            "order by blog.created desc;")
    @Select("select blog.blog_id blogId, category.category_name categoryName, title, author, blog.created " +
            "from blog_w.blog " +
            "left join blog_w.category " +
            "on blog.category_id=category.category_id " +
            "where blog.deleted is null and blog.category_id like #{categoryId} " +
            "order by blog.created desc;")
    List<BlogVO> findAll(String categoryId);

}
